//package com.ptu.controller;
//
//import com.ptu.server.AuthService;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.Map;
//
//@RestController
//@RequestMapping("/auth")
//public class AuthController {
//
//    private final AuthService authService;
//
//    public AuthController(AuthService authService) {
//        this.authService = authService;
//    }
//
//    @PostMapping("/login")
//    public ResponseEntity<?> login(@RequestBody LoginRequest loginRequest) {
//        String token = authService.login(loginRequest.getUsername(), loginRequest.getPassword());
//        return ResponseEntity.ok(Map.of("token", token));
//    }
//
//    @PostMapping("/register")
//    public ResponseEntity<?> register(@RequestBody LoginRequest loginRequest) {
//        boolean result = authService.register(
//                loginRequest.getUsername(),
//                loginRequest.getPassword());
//
//        return result ? ResponseEntity.ok().build() : ResponseEntity.badRequest().build();
//    }
//}